#include<stdio.h>
typedef struct student
{
    long ID;
    char name[21];
    int chn;
    int math;
    int eng;
}STU;
int main()
{
    int n;
    scanf("%d", &n);
    STU a[100];
    int maxsum = 0, maxstu = 0, sum[100];
    for(int i = 0; i < n; i ++)
    {
        scanf("%ld %s %d %d %d", &a[i].ID, a[i].name, &a[i].chn, &a[i].math, &a[i].eng);
        sum[i] = a[i].chn + a[i].math + a[i].eng;
        if(maxsum < sum[i])
        {
            maxsum = sum[i];
            maxstu = i;
        } 
    }
    printf("%ld %s %d %d %d\n", a[maxstu].ID, a[maxstu].name, a[maxstu].chn, a[maxstu].math, a[maxstu].eng);
    return 0;
}